import 'package:flutter/material.dart';

class ModalWidget extends StatelessWidget {
  final dynamic data;

  ModalWidget(this.data);

  @override
  Widget build(BuildContext context) {
    String s0=data.bigname??"";
    String s1=data.bigcode??"";
    String s2=data.middlename??"";
    String s3=data.middlecode??"";
    String s4=data.smallname??"";
    String s5=data.smallcode??"";
    return Scaffold(
      backgroundColor: Colors.black.withOpacity(0.65),
      body: Stack(
        fit: StackFit.expand,
        children: <Widget>[
          GestureDetector(onTap: () {
            Navigator.of(context).pop();
          }),
          Center(
              child: ConstrainedBox(
            constraints: BoxConstraints(
              maxWidth: MediaQuery.of(context).size.width - 80,
              maxHeight: MediaQuery.of(context).size.height - 160,
            ),
            child: Container(
                decoration: BoxDecoration(color: Colors.white),
                child: Stack(
                  children: <Widget>[
                    Positioned(
                      left: 0,
                      right: 0,
                      height: 40,
                      child: Container(
                        alignment: AlignmentDirectional.center,
                        color: Color(0xff408DF7),
                        child: Text(
                          "详情",
                          style: TextStyle(color: Colors.white, fontSize: 16),
                        ),
                      ),
                    ),
                    Positioned(
                        top: -3,
                        right: 0,
                        child: IconButton(
                            icon: Icon(
                              Icons.clear,
                              color: Colors.white,
                            ),
                            onPressed: () {
                              Navigator.of(context).pop();
                            })),
                    Container(
                      width: double.infinity,
                      padding: EdgeInsets.only(
                          left: 10, right: 10, top: 50, bottom: 20),
                      child: Scrollbar(
                          child: SingleChildScrollView(
                        child: Column(
                          children: <Widget>[
                            Padding(padding: EdgeInsets.only(bottom: 10),
                              child: Container(
                                decoration: BoxDecoration(
                                    image: DecorationImage(
                                        image: AssetImage("assets/images/card_background.png"),
                                        fit: BoxFit.fill
                                    )
                                ),
                                width: 210,
                                padding: EdgeInsets.all(10),
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: <Widget>[
                                    Center(
                                      child: Text("物资大类",style: TextStyle(color: Colors.white),),
                                    ),
                                    Text("名称：$s0",style: TextStyle(color: Colors.white)),
                                    Text("编码：$s1",style: TextStyle(color: Colors.white)),
                                  ],
                                ),
                              )
                            ),
                            Padding(padding: EdgeInsets.only(bottom: 10),
                              child: Container(
                                decoration: BoxDecoration(
                                    image: DecorationImage(
                                        image: AssetImage("assets/images/card_background.png"),
                                        fit: BoxFit.fill
                                    )
                                ),
                                width: 210,
                                padding: EdgeInsets.all(10),
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: <Widget>[
                                    Center(
                                      child: Text("物资中类",style: TextStyle(color: Colors.white),),
                                    ),
                                    Text("名称：$s2",style: TextStyle(color: Colors.white)),
                                    Text("编码：$s3",style: TextStyle(color: Colors.white)),
                                  ],
                                ),
                              )
                            ),
                             Container(
                                decoration: BoxDecoration(
                                    image: DecorationImage(
                                        image: AssetImage("assets/images/card_background.png"),
                                        fit: BoxFit.fill
                                    )
                                ),
                                width: 210,
                                padding: EdgeInsets.all(10),
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: <Widget>[
                                    Center(
                                      child: Text("物资小类",style: TextStyle(color: Colors.white),),
                                    ),
                                    Text("名称：$s4",style: TextStyle(color: Colors.white)),
                                    Text("编码：$s5",style: TextStyle(color: Colors.white)),
                                  ],
                                ),
                              )

                          ],
                        ),
                      )),
                    )
                  ],
                )),
          )), //构建具体的对话框布局内容
        ],
      ),
    );
  }
}
